<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
  <script>
      // let uname = 'w'
      // if (uname)
          // alert("欢迎"+uname+"回来")
      // else
        // alert("not login")

      // 选择分支
      let gender = 2
      switch (gender)
      {
          case 1 :
              console.log("男");break;
          case 2:
              console.log("女");break;
          default:
              console.log("未知")
      }


      let names = ['tome','jack','rose']
      // 使用var定义的循环变量在外部也可以被访问  如果用let定义的循环变量，在循环外部无法被访问
      for (let i = 0 ; i < names.length; i++)
      {
          console.log(names[i])
      }

      // console.log(i)



      //增强for循环
      for (let n of names)
      {
          console.log(n)
      }

  </script>
</body>
</html>